Complex polynomial roots toy

Grab the red dots and play around! Or jump to the explanation, or try this.

0.511.52−0.5−1−1.5−20.511.52−0.5−1−1.5−2
 –  o  +  ←  ↓  ↑  → 
Re[ai]
Im[ai]
Coefficients
a0
a1
a2
a3
0.511.52−0.5−1−1.5−20.511.52−0.5−1−1.5−2
 –  o  +  ←  ↓  ↑  → 
Re[z]
Im[z]
Roots

Explanation

A polynomial in x of degree n has the form

(1)P(x)=i=0naixi.

From the fundamental theorem of algebra, there are exactly n roots ziC in the complex plane.1 The same polynomial can be written as

(2)P(x)=an(xz1)(xz2)(xzn).

Let’s set an=1 for simplicity (this is called a monic polynomial).

Now, if you have the roots, finding the values of the coefficients ai is straightforward: just expand out the product in Eq. (2). The functions ai(z1,z2,,zn) are known as elementary symmetric polynomials (up to a sign). If you move a root, you can see how all the coefficients change.

Solving for the zi’s from the ai’s with some algebraic formula is possible for n4 but generally impossible for higher degrees.2 Nonetheless, we can numerically solve for roots with various numerical algorithms.3 If you move a coefficient, your computer will solve for the new locations of the roots, and you can see how they respond.

Things to try

Grab a coefficient ai and move it around in a closed loop. If it comes back to where it started, then the set of roots {zj} have to return to the starting set.

But we can also talk about each individual root’s trajectory as ai is varied. If ai moves in a very small loop, so does each zj.

Now try to find a larger loop for some ai so that some zj’s swap places!

Hint (spoiler): a really simple choice is to move a0 around the unit circle, if all the other ai’s are close to the origin. Then you should see the n roots zj each shift one spot to the left/right around their unit circle. This is an n-cycle.

Try to find a 2-cycle (two roots swap places) or other more complicated types of permutations.

What we have here is a map from closed loops in a-space to permutations of the n roots.

Question: What determines the type of permutation (cycle structure or conjugacy class)? Hint: It has something to do with the zeros of the discriminant. To understand the relationship, check the box to view the discriminant’s roots. When you drag a coefficient ai, you will see the roots of the discriminant (treated as univariate, holding fixed all other aji).

Acknowledgments

This toy was somewhat inspired by John Baez’s post, which in turn was discussing this tumblr post.

This toy makes use of JSXGraph and my extended version of Polynomial.js.3

Suggestions welcome!

  1. I’m only considering aiC; things like polynomials over finite fields are trickier! 

  2. Proved by Évariste Galois before his death in a duel at age 20. 

  3. For root-finding, I implemented the Aberth-Ehrlich method into the javascript package Polynomial.js, following Dario Bini’s paper and his FORTRAN implementation. To evaluate the discriminant, I compute the determinant of the Bézout matrix 2